//
//  TestCollectionViewController.m
//  Demo
//
//  Created by yc on 2017/11/13.
//  Copyright © 2017年 lc4y. All rights reserved.
//

#import "TestCollectionViewController.h"

@interface TestCollectionViewController ()

@end

@implementation TestCollectionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

#pragma mark -
#pragma mark - ConfigSubView

- (void)cy_configSubView {
//    [self cy_createListView:@"TestCollectionView" viewType:CYListViewCollectionView];
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    [self cy_createCollectionView:@"TestCollectionView" collectionViewLayout:layout];
}

- (void)cy_configSubViewStyle {
    [self.cy_collectionView cy_registerCellNib:@"TestCollectionViewCell"];
    [self.cy_collectionView cy_registerCellNib:@"TestCollectionViewCell02"];
    [self.cy_collectionView cy_registerHeaderNib:@"TestCollectionSectionHeaderView"];
    [self.cy_collectionView cy_registerHeaderClass:@"TestCollectionSectionFooterView"];
    [self.cy_collectionView cy_registerFooterClass:@"TestCollectionSectionFooterView"];
    self.cy_collectionView.backgroundColor = [UIColor whiteColor];
    
    self.cy_collectionView.cy_dataArray = @[@"1",@"2",@"3"];
    [self.cy_collectionView cy_addHeaderRefreshControl:^{
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self.cy_collectionView cy_endRefreshControl];
        });
    }];
    
    [self.cy_collectionView cy_addFooterRefreshMoreControl:^{
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self.cy_collectionView cy_endRefreshControl];
            self.cy_collectionView.cy_dataArray = @[];
        });
    }];
}

- (void)cy_masLayoutSubView {
    [self.cy_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
}

@end
